package com.itheima.restkeeper.handler.wchat.config;

import com.github.wxpay.sdk.IWXPayDomain;
import com.github.wxpay.sdk.WXPayConfig;
import com.github.wxpay.sdk.WXPayConstants;
import lombok.Data;

import java.io.InputStream;

@Data
public class WXPayConfigCustom extends WXPayConfig {

    private String wxpayAppid;

    private String wxpayMchId;

    private String wxpayAppSecret;

    @Override
    protected String getAppID() {
        return this.wxpayAppid;
    }

    @Override
    protected String getMchID() {
        return this.wxpayMchId;
    }

    @Override
    protected String getKey() {
        return this.wxpayAppSecret;
    }

    @Override
    protected InputStream getCertStream() {
        return null;
    }

    @Override
    protected IWXPayDomain getWXPayDomain() {
        return new IWXPayDomain() {
            @Override
            public void report(String s, long l, Exception e) {
            }

            @Override
            public DomainInfo getDomain(WXPayConfig wxPayConfig) {
                return new DomainInfo(WXPayConstants.DOMAIN_API, true);
            }
        };
    }
}
